package client;

import java.net.MalformedURLException;
import java.util.Date;

import org.codehaus.xfire.XFireFactory;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;

import com.health.exceptions.ValidatorException;
import com.health.exceptions.ValidatorLevelException;
import com.health.model.User;
import com.health.service.IUserService;

public class Client
{

	public static void main(String[] args) throws ValidatorLevelException,
			ValidatorException
	{

		System.out.println("WS executing.......");
		Service srvcModel = new ObjectServiceFactory().create(IUserService.class);
		XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance()
				.getXFire());

		String userWsURL = "http://localhost:8080/HealthManager2.0/service/IUserService";
		try
		{
			IUserService srvc = (IUserService) factory.create(srvcModel,userWsURL);
			User u = new User();
			u.setRegistertime(new Date());
			u.setId("11111111");
			u.setName("RRRRR");
			u.setPassword("password");
			u.setBirthdate(new Date());
			u.setEmail("1@1111.com");
			u.setGender(0);
			u.setLoginCount(0);
			u.setStatus(0);
			u.setPermission(0);
			srvc.insert(u);

		}
		catch (MalformedURLException e)
		{
			e.printStackTrace();
		}

	}

}
